﻿<!doctype html>
<html lang="zh">
<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> 
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>新肌会管理平台</title>
	<link rel="stylesheet" type="text/css" href="/newshop/login/css/default.css?213123">
	<link rel="stylesheet" type="text/css" href="/newshop/login/css/styles.css?213123">

	<link rel="stylesheet" href=" /newshop/assets/css/jquery.cover.css">
	<script src="/newshop/assets/js/jquery-1.10.2.min.js"></script>
	<script charset="UTF-8" src=" /newshop/assets/javascript/ajax.js"></script>

	<script charset="UTF-8" src=" /newshop/assets/javascript/jquery.cover.js"></script>
	<!--[if IE]>
		<script src="http://libs.baidu.com/html5shiv/3.7/html5shiv.min.js"></script>
	<![endif]-->
</head>
<body>
	<article class="htmleaf-container">
		<header class="htmleaf-header">
			<h1>新肌会管理平台 </h1>
			<div class="htmleaf-links">
				
			</div>
		</header>
		<div class="panel-lite">
		  <div class="thumbur">
		    <div class="icon-lock"></div>
		  </div>
		  <h4>用户登录</h4>
		  <div class="form-group">
		    <input id="user" required="required" class="form-control"/>
		    <label  class="form-label">用户名    </label>
		  </div>
		  <div class="form-group">
		    <input id="password" type="password" required="required" class="form-control"/>
		    <label class="form-label">密　码</label>
		  </div>
		  <button class="floating-btn"><i class="icon-arrow"></i></button>
		</div>
		
	</article>

<script>

    $("#password").keypress(function(e) {
        // 回车键事件
        if(e.which == 13) {
            $(".floating-btn").click();
        }
    });

    $(".floating-btn").click(function(){
		var user = $("#user").val();
		var password = $("#password").val();

		if(user == ""){
		    alert("请输入账号");
		    return;
		}
		if(password==""){
            alert("请输入密码");
            return;
		}

        var param={
            staffCode: user,
            password: password
        }

        Ajax.ajax({
            url: "/staff/login",
            data: param,
            type: "POST",
            dataType: 'json',
            success: function (res) {
                if (res.resultCode == 0) {
                    window.location.href='/index/index';
                }else{
                    alert(res.resultMsg);
				}
            },
            error: function(){
                alert("操作失败");
            }
        });


	});

</script>
	
</body>
</html>